package com.singfan.core.util;

import com.singfan.common.util.EncryptionUtil;

import java.util.UUID;

/**
 * Author: hansonghe
 * Date: 2015-08-27 16:41
 * Desc:
 */
public class ReservationCodeUtil {
    /**
     * 生成邀请码
     * @param metaData 生成邀请码所使用的元数据
     * @param length 邀请码的长度
     * @return 邀请码
     */
    public static String createReservationCode(String metaData, int length){
        String confusedText = metaData + "-" + UUID.randomUUID().toString();
        String md5 = EncryptionUtil.md5(confusedText);
        return md5.substring(0, length);
    }
}
